#ifndef __C1218_PL__
#define __C1218_PL__

#include "ansi_interface.h"

struct c1218_pl_ops {
	int (*init)(uint8_t port);
	int32_t (*read)(uint8_t port, uint8_t *buf, uint32_t size);
	int32_t (*prefetch)(uint8_t port, uint8_t *buf, uint32_t size);
	void (*write)(uint8_t port, uint8_t *buf, uint32_t size);
	int (*release)(uint8_t port);
	int (*set_baudrate)(uint8_t baudrate);
	int (*flush)(uint8_t port);
};

typedef struct c1218_pl {
	char devname[20];
	uint8_t baudrate;
	uint8_t Aqport;

	struct c1218_pl_ops *ops;
} c1218_pl_t;

#define DEF_BAUDRATE	0

extern int c1218_pl_init(c1218_pl_t *pl);
extern int c1218_pl_run(c1218_pl_t *pl);
extern int c1218_pl_write(c1218_pl_t *pl, uint8_t *buf, int size);
extern int c1218_pl_read(c1218_pl_t *pl, uint8_t *buf, int size);
extern int c1218_pl_release(c1218_pl_t *pl);
extern int c1218_pl_iflush(c1218_pl_t *pl);
extern int c1218_pl_set_baudrate(c1218_pl_t *pl, uint8_t baudrate);
extern int c1218_pl_prefetch(c1218_pl_t *pl, uint8_t *buf, int size);

#endif
